module Extender (
    immediate,
    Sign,
    extend
);
    input [15:0] immediate;
    input Sign;
    output reg [31:0] extend;
    always @(*) begin
         if(Sign)//符号拓展
            extend={{16{immediate[15]}},{immediate[15:0]}};
        else
            extend={{16'b0000000000000000},{immediate[15:0]}};
    end
   

endmodule //ext